home *** CD-ROM | disk | FTP | other *** search
- Path: mindlink.bc.ca!a10699
- From: Greg_Butler@mindlink.bc.ca (Greg Butler)
- Newsgroups: comp.lang.c
- Subject: Far pointer problem.
- Date: Tue, 30 Jan 96 21:09:09 -0800
- Organization: MIND LINK! - British Columbia, Canada
- Distribution: world
- Message-ID: <82967-823064949@mindlink.bc.ca>
- NNTP-Posting-Host: mindlink.net
-
- Could someone help me with this odd problem? I am trying to pass a pointer
- from process A to process B so that process A can have knowlege of the
- location of a variable in process B. This would be like having a data
- transfer area that is shared between processes. I thought this would not be
- to difficult, but I am lost in C pointers. I tried to simulate the problem
- with the following small C routine. I have
- a variable in "process A" located at 6525:01c0, and I have a varable in
- "process B" called "thingone". I would like to have the address of
- "thingone"
- to be the contents of "6525:01c0". The address needs to be the segement and
- offset. I think I am close but I have been stairing at this code for a long
- time and am probably missing the obvious.
-
- Thanks in advance.
-
- /* test c program */
-
- int thingone;
- int far *thingtwo;
-
- main()
- {
- thingtwo = (int far *)0x652501c0;
- stub( &thingtwo );
- }
-
- stub( int far **point )
- {
- *point = &thingone;
- thingone = 0xabcd;
- }
-
- --
- Greg_butler@mindlink.bc.ca
-